package lab03.test03;

import java.io.*;

public class Test03 {
    public static void main(String[] args) throws IOException {
        File fe = new File("D:\\test.txt");

        if (!fe.exists()) {
            fe.createNewFile();
        }
        byte[] b = "beijing 欢迎你".getBytes();
        FileOutputStream out = new FileOutputStream(fe);
        out.write(b);
        out.close();

        FileReader in = new FileReader(fe);

        int i = 0;
        while ((i = in.read()) != -1) {
            System.out.print((char) i);
        }
        System.out.println();

        FileWriter writer = new FileWriter("D://test.txt", true);
        writer.write("我的学号是：1606101037");
        writer.close();

        FileReader fileReader = new FileReader(fe);
        int j = 0;
        while ((j = fileReader.read()) != -1) {
            System.out.print((char) j);
        }
    }
}
